<script type="text/javascript">
function base_url (){
	return "<?php echo base_url()?>";
}
window.gcConf = typeof window.gcConf == 'undefined' ? {} : window.gcConf;
window.gcConf = $.extend(window.gcConf,{
	unset_image_preview : <?php echo $this->unset_image_preview?'true':'false' ?>,
	unset_image_preview_anchor :<?php echo $this->unset_image_preview_anchor?'true':'false' ?>,
	subject_cls:'<?php echo strtolower(preg_replace('/\s/i', '-', $subject))?>',
	subject:'<?php echo $subject?>',
	state:<?php echo json_encode(ucfirst($this->getState()))?>
}); 
</script>
<?php 
	$ci =& get_instance();
	$data = array(
		'subject' => $subject,
		'gc' => $this
	);
	$auto_include_view = auto_include_view();
	foreach( $auto_include_view as $path )
	{
		if(preg_match('/_pre/i', $path))
		if(file_exists(APPPATH.'views/'.$path.'.php'))
		{
			$ci->load->view($path,$data);
		}
	}
?>
<div  style='width: auto;margin-top: 77px;' class="read-from flexigrid crud-form read <?php echo strtolower(preg_replace('/\s/i', '-', $subject))?> <?php echo $ci->config->item('grocery_crud_dialog_forms') ? '':'rounded' ?>" data-unique-hash="<?php echo $unique_hash; ?>">

	<div  style="height:120px;display:none" class="tDiv ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-accordion-icons" style="display:<?php echo $ci->config->item('grocery_crud_dialog_forms') ? 'none':'block' ?>">
		<div class="ftitle">
			<div class='ftitle-left list-title-pre'>
				<h3><?php echo $this->l('list_record'); ?> <?php echo $subject?></h3>
			</div>
			<div class='clear'></div>
		</div>
		<div title="<?php echo $this->l('minimize_maximize');?>" class="ptogtitle">
			<span></span>
		</div>
	</div>
<div id='main-table-box-read' style="padding:29px">
	<?php echo form_open( $read_url, 'method="post" id="crudForm" autocomplete="off" enctype="multipart/form-data"'); ?>
	<div class='form-div'>
		<?php
		$counter = 0;
			foreach($fields as $field)
			{
				$even_odd = $counter % 2 == 0 ? 'odd' : 'even';
				$counter++;
		?>
			<div class='form-field-box <?php echo $even_odd?>' id="<?php echo $field->field_name; ?>_field_box">
				<div class='form-display-as-box' id="<?php echo $field->field_name; ?>_display_as_box">
					<?php echo $input_fields[$field->field_name]->display_as?><?php echo ($input_fields[$field->field_name]->required)? "<span class='required'>*</span> " : ""?>
				</div>
				<div class='form-input-box' id="<?php echo $field->field_name; ?>_input_box">
					<?php echo $input_fields[$field->field_name]->input?>
				</div>
				<div class='clear'></div>
			</div>
		<?php }?>
		<?php if(!empty($hidden_fields)){?>
		<!-- Start of hidden inputs -->
			<?php
				foreach($hidden_fields as $hidden_field){
					echo $hidden_field->input;
				}
			?>
		<!-- End of hidden inputs -->
		<?php }?>
		<?php if ($is_ajax) { ?><input type="hidden" name="is_ajax" value="true" /><?php }?>
		<div id='report-error' class='report-div error'></div>
		<div id='report-success' class='report-div success'></div>
	</div>
	<div class="pDiv">
		<div class='form-button-box'>
			<input type='button' value='<?php echo $this->l('form_back_to_list'); ?>' class="btn btn-large back-to-list" id="cancel-button" mt="read" />
		</div>
		<div class='form-button-box'>
			<div class='small-loading' id='FormLoading'><?php echo $this->l('form_update_loading'); ?></div>
		</div>
		<div class='clear'></div>
	</div>
	<?php echo form_close(); ?>
</div>
</div>
<script>
	var validation_url = '<?php echo $validation_url?>';
	var list_url = '<?php echo $list_url?>';

	var message_alert_edit_form = "<?php echo $this->l('alert_edit_form')?>";
	var message_update_error = "<?php echo $this->l('update_error')?>";
</script>
<?php 

	foreach($auto_include_view as $path )
	{
		if(!preg_match('/_pre/i', $path))
		if(file_exists(APPPATH.'views/'.$path.'.php'))
		{
			$ci->load->view($path,$data);
		}
	}
?>